package com.zkx.fssb.controller.server;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zkx.fssb.domain.po.Bouquet;
import com.zkx.fssb.result.PageQuery;
import com.zkx.fssb.result.Result;
import com.zkx.fssb.service.BouquetService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@Slf4j
@RestController("serverBouquetController")
@RequestMapping("/server/bouquet")
public class BouquetController {

    @Autowired
    private BouquetService bouquetService;

    /**
     * 管理端 分页查询
     * @param pageQuery
     *
     * @return
     */
    @GetMapping("/page")
    public Result<Page> getPage(PageQuery pageQuery){
        log.info(pageQuery.toString());
        Page page =bouquetService.customPage(pageQuery);



        return Result.success(page);


    }


    @GetMapping("/getById")
    public Result<Bouquet> getById(Integer bouquetId){
        Bouquet bouquet = bouquetService.getById(bouquetId);

        return Result.success(bouquet);

    }






}
